<?php
namespace application\admin\model;
use think\Config;

class AuthRule extends Base
{
    // 类型转换
    protected $type = [
        'type'      => 'integer',
        'status'    => 'integer'
    ];

    public function getList($params = [])
    {
        $result     = [];
        $condition  = [];

        if( isset($params['status']) ) {
            $condition['status'] = intval($params['status']);
        }

        // 分页记录数
        if( isset($params['size']) )
            $size = intval($params['size']);
        else
            $size = Config::get('page_size');

        // 页数
        if( isset($params['page']) )
            $page = intval($params['page']) > 0 ? intval($params['page']) : 1;
        else
            $page = 1;

        $result = $this->where($condition)->page($page, $size)->select();

        return $result;
    }

}